<template>
  <view class="publish-page">
    <view class="b-r10 b-w b-shadow inner-page">
      <view>请发布您的需求:</view>
      <view class="my-text">
        <u--textarea
          v-model="publishContent"
          maxlength="150"
          count
          autoHeight
          placeholder="请输入内容"
        ></u--textarea>
      </view>
      <view class="confirm-btn">
        <u-button type="primary" text="提交" @click="handleSubmit"></u-button>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      publishContent: '',
    }
  },
  methods: {
    handleSubmit() {
      if (this.publishContent) {
        this.$request('/enterprisePublishApply/enterprisePublishApply', {
          content: this.publishContent,
        }).then((res) => {
          this.$utils.toast('发布成功')
          setTimeout(() => {
            uni.navigateBack({})
          }, 1000)
        })
      } else {
        this.$utils.toast('请输入需求内容')
      }
    },
  },
}
</script>

<style scoped lang="scss">
.publish-page {
  padding: 20rpx;
  .inner-page {
    padding: 20rpx;
    .my-text {
      margin-top: 20rpx;
    }
    .confirm-btn {
      margin-top: 20rpx;
    }
  }
}
</style>
